#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n, q;
int a[8005];
struct Tmp{
	int pla, num;
} b[8005];
int op, p, v;
int main(){
	freopen("sort.in", "r", stdin);
	freopen("sort.out", "w", stdout);
	scanf("%d %d", &n, &q);
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	if(n <= 500 && q <= 500){
		for(int i = 1; i <= q; i++){
			scanf("%d %d", &op, &p);
			if(op == 1){
				scanf("%d", &v);
				a[p] = v;
				continue;
			}
			for(int j = 1; j <= n; j++)
				b[j].pla = j, b[j].num = a[j];
			Tmp t;
			for(int i = 1; i <= n; i++)
				for(int j = i; j >= 2; j--)
					if(b[j].num < b[j - 1].num){
						t.num = b[j].num, t.pla = b[j].pla;
						b[j] = b[j - 1];
						b[j - 1] = t;
					}
			for(int j = 1; j <= n; j++)
				if(b[j].pla == p){
					printf("%d\n", j);
					break;
				}
		}
		return 0;
	}
	return 0;
}

